1. Field of the Invention
The invention generally concerns systems which are constructed using programs organized around objects and more particularly concerns objects whose classes are defined at compile time. In an embodiment of the invention, the objects are widgets of the type employed in the X Window graphical user interface system.
2. Description of the Prior Art
Two approaches have generally been used in the prior art to create systems for executing applications. The first approach has been to write a single program for the entire application; for example, a payroll application might be written as a single COBOL program.
The second approach has been to use a set of cooperating processes to create the application. In this context, a process is an instance of a program in execution. For example, the payroll application might employ a first program executing in one process to collect the data, a second program executing in another process to sort the data, a third program executing in a third process to update the payroll records, a fourth program executing in a fourth process to print the payroll records, and so on. Communication between the cooperating processes is by means of inter-process communications. The second approach has several important advantages over the first. To begin with, the programs executed in the processes are often standard utility programs, instead of custom-made programs, and it is generally faster and cheaper to combine such standard utility programs than it is to write new code. Further, the second approach is better adapted to systems having more than one processing unit: each of the processes can can run on a different processing unit, and if the application is of the right kind, the programs can be executing in the processes in parallel. Finally, since the processes communicate by means of inter-process communications, the applications are easily adapted to distributed systems, i.e., multi-processor systems in which the processors are in different locations.
A problem for the technique of creating an application as a set of cooperating processes has been the increased use of objects to organize programs. An object is an entity operated on by a program. Whenever the program operates on the object, it must do so using a set of operations defined for the object. The chief advantage of using objects to organize programs is that an object can be dealt with as a logical entity in the program, without regard to the manner in which the logical entity is actually implemented. For example, as a logical entity, a queue has four operations: creating the queue, destroying the queue, adding a value to the tail of the queue, and taking a value from the head of the queue. If a program only uses those operations on the data structure representing the queue, then the data structure may be changed without affecting other parts of the program.
In many object-based programming systems, objects have classes. An object's class is the set of operations defined for the object. For instance, an object upon which the operations of creation, destruction, adding a value to the tail, and taking a value from the head can be performed is an object of class queue. Classes may stand in hierarchical relations with other classes. For example, a program may require a queue upon which not only the four operations listed above can be performed, but also an additional operation: finding the number of items presently in the queue. The addition of the new operation results in a new class of queue objects. Since the new class has all of the operations of the original queue class, the new class is a subclass of the original queue class and the original queue class is a superclass of the new queue class.
The hierarchy may be many levels deep. Each class in the hierarchy is a subclass of all of the classes between it and the first class in the hierarchy and a superclass of all classes below it in the hierarchy. Further, a subclass inherits all of the operations defined for all of its superclasses, i.e., an operation defined for any of the superclasses can be performed on objects of the subclass. Inheritance greatly increases the efficiency of programming with objects, since all that is required to define a new object class is a definition of the new operations; all of the inherited operations are defined in the superclasses.
There are two reasons why object-oriented programming conflicts with the technique of creating an application as a set of cooperating programs. The first reason is that an object's class is defined at compile time, that is, at the time that the source code for the program is translated into object code which can be executed by an actual computer system. The technique of creating an application as a set of cooperating processes, on the other hand, often requires that the cooperating processes must be able to create objects whose class is defined at run time, that is, when the application is actually executed by the computer system.
The second reason is the difficulty of communicating with processes in programs written using the X Window graphical user interface system. The X Window system uses objects called widgets. Unfortunately, the class hierarchy for widgets does not include operations which permit easy communication with processes, and consequently, the X Window graphical user interface system cannot be used with applications implemented as cooperating procedures.
It is an object of the invention disclosed herein to solve these and other problems of object-based programming systems generally and of the X Window system in particular.